package com.ruoyi.statisticalCenter.mapper;

import com.ruoyi.statisticalCenter.domain.ScOutReturnSheet;
import com.ruoyi.statisticalCenter.domain.vo.ScOutReturnSheetVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

@Mapper
public interface ScOutReturnSheetMapper {
    List<ScOutReturnSheet> collect(ScOutReturnSheetVo vo);

    //子客户
    List<ScOutReturnSheet> collectChildClient(ScOutReturnSheetVo vo);

    //客户发件数计算
    Integer selectClientOneToThree( @Param("startTime") String startTime,
                                    @Param("endTime") String endTime,
                                    @Param("startWeight") Double startWeight,
                                    @Param("endWeight") Double endWeight);

    //日业务量计算
    Integer selectClientOneToThreeDaily();

    // 金额

    Integer deleteTicket(@Param("startTime") String startTime,
                                            @Param("endTime") String endTime,
                                            @Param("startWeight") Double startWeight,
                                            @Param("endWeight") Double endWeight,
                                            @Param("name") String name
    );

    List<Map<String,Object>> deleteTicketMap(@Param("startTime") String startTime,
                                          @Param("endTime") String endTime,
                                          @Param("startWeight") Double startWeight,
                                          @Param("endWeight") Double endWeight
    );

    List<Map<String,Object>> deleteTicketMapByContractArea(@Param("startTime") String startTime,
                                             @Param("endTime") String endTime,
                                             @Param("startWeight") Double startWeight,
                                             @Param("endWeight") Double endWeight
    );

    //计算返利基数
    Integer countReturn0To5(ScOutReturnSheetVo vo);
    Integer countReturn0Point5To1(ScOutReturnSheetVo vo);
    Integer countReturn1To3();


//    计算金额合计
    BigDecimal countAmount(@Param("startTime") String startTime,
                           @Param("endTime") String endTime,
                           @Param("startWeight") Double startWeight,
                           @Param("endWeight") Double endWeight);

    /**
     * 根据传入日期，从hq_network_bill_detail表中
     *      取出明细数据添加到sc_out_return_sheet_detail表中
     * @param date
     * @return
     */
    int InsertScOutReturnSheetDetailDataByDates(String date);


}
